package com.apps.diet.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Service;

import com.apps.diet.dao.IUserDietPlanDao;
import com.apps.diet.domain.UserDietPlan;

@Service("userDietPlanService")
//@Transactional
public class UserDietPlanService implements IUserDietPlanService {

	protected static Logger logger = Logger.getLogger(UserDietPlanService.class);
	
	IUserDietPlanDao userDietPlanDao;
	
	@Autowired
	@Required
	public void setDietDao(IUserDietPlanDao userDietPlanDao) {
		this.userDietPlanDao = userDietPlanDao;
	}

	@Override
	public List<UserDietPlan> getUserDietPlan(int searchString) {
		List<UserDietPlan> results = userDietPlanDao.getUserDietPlan(searchString);
		return results;
	}

	@Override
	public boolean updateUserDietPlan(UserDietPlan userDietPlan) {
		return userDietPlanDao.updateUserDietPlan(userDietPlan);
	}

	@Override
	public boolean createUserDietPlan(UserDietPlan userDietPlan) {
		return userDietPlanDao.createUserDietPlan(userDietPlan);
	}

	@Override
	public boolean deleteUserDietPlan(int userDietPlanId) throws Exception {
		return userDietPlanDao.deleteUserDietPlan(userDietPlanId);
	}
}
